export default {
  name: 'exchangeCoupon',
  data () {
    return {
      isFocus: false,
      couponCode: "",
      promptMsg: "兑换码不能为空",
      exchangeBool: false
    }
  },
  mounted: function(){
  	window.document.title = "兑换优惠券";
  },
  methods: {
		showClear: function(){
			if(this.couponCode){
				this.isFocus = true;
			}else{
				this.isFocus = false;
			}
		},
		clearCouponCode: function(){
			this.couponCode = "";
			this.isFocus = false;
		},
		exchange: function(){
			if(this.couponCode){
				if(this.couponCode == 1234){
					alert();
				}else{
					this.promptMsg = "兑换码无效";
					this.exchangeBool = true;
				}
			}else{
				this.promptMsg = "兑换码不能为空";
				this.exchangeBool = true;
			}
		},
		afterEnter: function(){
			var _this = this;
			setTimeout(function(){
				_this.exchangeBool = false;
			}, 1000);
		}
	}
}